from ctypes import *

from ctypes.wintypes import UINT
from ctypes.wintypes import DWORD
_stdcall_libraries = {}
_stdcall_libraries['winmm.dll'] = WinDLL('winmm.dll')
from ctypes.wintypes import LPVOID
from ctypes.wintypes import LPSTR
from ctypes.wintypes import WORD


class HWAVEOUT__(Structure):
    pass
HWAVEOUT = POINTER(HWAVEOUT__)
class wavehdr_tag(Structure):
    pass
WAVEHDR = wavehdr_tag
class tWAVEFORMATEX(Structure):
    pass
WAVEFORMATEX = tWAVEFORMATEX
MMRESULT = UINT
LPHWAVEOUT = POINTER(HWAVEOUT)
LPCWAVEFORMATEX = POINTER(WAVEFORMATEX)
ULONG_PTR = c_ulong
DWORD_PTR = ULONG_PTR
waveOutOpen = _stdcall_libraries['winmm.dll'].waveOutOpen
waveOutOpen.restype = MMRESULT
waveOutOpen.argtypes = [LPHWAVEOUT, UINT, LPCWAVEFORMATEX, DWORD_PTR, DWORD_PTR, DWORD]
waveOutClose = _stdcall_libraries['winmm.dll'].waveOutClose
waveOutClose.restype = MMRESULT
waveOutClose.argtypes = [HWAVEOUT]
LPWAVEHDR = POINTER(wavehdr_tag)
waveOutPrepareHeader = _stdcall_libraries['winmm.dll'].waveOutPrepareHeader
waveOutPrepareHeader.restype = MMRESULT
waveOutPrepareHeader.argtypes = [HWAVEOUT, LPWAVEHDR, UINT]
waveOutUnprepareHeader = _stdcall_libraries['winmm.dll'].waveOutUnprepareHeader
waveOutUnprepareHeader.restype = MMRESULT
waveOutUnprepareHeader.argtypes = [HWAVEOUT, LPWAVEHDR, UINT]
waveOutWrite = _stdcall_libraries['winmm.dll'].waveOutWrite
waveOutWrite.restype = MMRESULT
waveOutWrite.argtypes = [HWAVEOUT, LPWAVEHDR, UINT]
MM_WOM_CLOSE = 956 # Variable c_int '956'
MMSYSERR_NOERROR = 0 # Variable c_int '0'
WAVE_MAPPER = 4294967295L # Variable c_uint '-1u'
CALLBACK_FUNCTION = 196608 # Variable c_long '196608l'
CALLBACK_NULL = 0 # Variable c_long '0l'
MM_WOM_DONE = 957 # Variable c_int '957'
WAVE_FORMAT_PCM = 1 # Variable c_int '1'
WAVERR_STILLPLAYING = 33 # Variable c_int '33'
MM_WOM_OPEN = 955 # Variable c_int '955'
WAVERR_BASE = 32 # Variable c_int '32'
HWAVEOUT__._pack_ = 1
HWAVEOUT__._fields_ = [
    ('unused', c_int),
]
CHAR = c_char
wavehdr_tag._pack_ = 1
wavehdr_tag._fields_ = [
    ('lpData', LPSTR),
    ('dwBufferLength', DWORD),
    ('dwBytesRecorded', DWORD),
    ('dwUser', DWORD_PTR),
    ('dwFlags', DWORD),
    ('dwLoops', DWORD),
    ('lpNext', POINTER(wavehdr_tag)),
    ('reserved', DWORD_PTR),
]
tWAVEFORMATEX._pack_ = 1
tWAVEFORMATEX._fields_ = [
    ('wFormatTag', WORD),
    ('nChannels', WORD),
    ('nSamplesPerSec', DWORD),
    ('nAvgBytesPerSec', DWORD),
    ('nBlockAlign', WORD),
    ('wBitsPerSample', WORD),
    ('cbSize', WORD),
]
__all__ = ['MM_WOM_DONE', 'MM_WOM_OPEN', 'DWORD_PTR', 'LPHWAVEOUT',
           'CHAR', 'HWAVEOUT__', 'ULONG_PTR', 'tWAVEFORMATEX',
           'WAVE_MAPPER', 'WAVEFORMATEX', 'waveOutOpen', 'WAVEHDR',
           'CALLBACK_FUNCTION', 'WAVERR_STILLPLAYING', 'WAVERR_BASE',
           'LPCWAVEFORMATEX', 'LPWAVEHDR', 'waveOutClose',
           'wavehdr_tag', 'HWAVEOUT', 'MM_WOM_CLOSE',
           'MMSYSERR_NOERROR', 'waveOutUnprepareHeader',
           'WAVE_FORMAT_PCM', 'CALLBACK_NULL', 'waveOutPrepareHeader',
           'MMRESULT', 'waveOutWrite']
